package com.jdz.noise.entities;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class GPS {

    double lat;
    double lon;
    double h;



    public double[] toArray()
    {
        double[] d = new double[3];
        d[0] = lat;
        d[1] = lon;
        d[2] = h;

        return d;
    }
    public GPS(double lat1,double lat2,double lat3,double lon1,double lon2,double lon3,double h)
    {
        this.lat = lat1+lat2/60+lat3/3600;
        this.lon = lon1+lon2/60+lon3/3600;
        this.h = h;
    }
//    public GPS(double lat,double lon,double h)
//    {
//        this.lat = lat;
//        this.lon = lon;
//        this.h = h;
//    }
    public GPS(double[] gps)
    {
        this.lat = gps[0]+gps[1]/60+gps[2]/3600;
        this.lon = gps[3]+gps[4]/60+gps[5]/3600;
        this.h = gps[6];
    }
    public GPS(FlyRow flyRow)//输入flyRow以获得
    {
        this.lat = flyRow.getGPS_LAT_du()+flyRow.getGPS_LAT_fen()/60+flyRow.getGPS_LAT_miao()/3600;
        this.lon = flyRow.getGPS_LONG_du()+flyRow.getGPS_LONG_fen()/60+flyRow.getGPS_LONG_miao()/3600;
        this.h = flyRow.getGPS_H_miao();
    }
    public void setGPS(double[] gps)
    {
        this.lat = gps[0]+gps[1]/60+gps[2]/3600;
        this.lon = gps[3]+gps[4]/60+gps[5]/3600;
        this.h = gps[6];
    }
}
